//
//  ListViewCell.m
//  KoreaFlower
//
//  Created by Nicejinux on 12. 11. 11..
//  Copyright (c) 2012년 Nicejinux. All rights reserved.
//

#import "ListViewCell.h"

@implementation ListViewCell

@synthesize thumnailView;
@synthesize titleLabel, categoryLabel, priceLabel;

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
    }
    return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setProductListCell:(NSDictionary *)dic tabIndex:(int)tabIndex cellIndex:(NSInteger)index {
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    self.titleLabel.text = [dic objectForKey:@"flowerName"];
    self.priceLabel.text = [dic objectForKey:@"price"];
    self.categoryLabel.text = [dic objectForKey:@"saleCategoryName"];

    NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
    NSString *cdn = [ud objectForKey:@"cdn0"];
    NSString *name = [dic objectForKey:@"imgName"];
    NSString *surfix = [dic objectForKey:@"imgNameSurfix"];
    
    if ([surfix isEqual:[NSNull null]]) {
        surfix = @"";
    }
    NSString *url = [NSString stringWithFormat:@"%@%@%@.jpg",cdn, name, surfix];

    [thumnailView loadURLImage:url loadingImage:@"Loading.png" noImage:@"Loading.png"];

}
@end
